import service from '/@/utils/request';

export const articleApi = {
    listArticle: (query?: ArticleQueryDto) => {
        return service.get<PageResult<ArticleVo>, ArticleQueryDto>('/admin/article', {
            params: query
        });
    },
    getArticle(articleId: number) {
        return service.get<ArticleVo>(`/admin/article/${articleId}`);
    },
    saveOrUpdateArticle(articleSaveOrUpdateDto: ArticleSaveOrUpdateDto) {
        return service.post<ArticleVo>(`/admin/article/saveOrUpdate`, articleSaveOrUpdateDto);
    },
    setting(articleSettingDto: ArticleSettingDto) {
        return service.put<ArticleVo>(`/admin/article/setting`, articleSettingDto);
    },
    deleteArticle(articleId: number) {
        return service.delete<boolean>(`/admin/article/${articleId}`);
    },
}